home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-01-05 | 2.5 KB | 60 lines | [TEXT/GEOL] |
- Item 8074935 4-Jan-90 12:07
-
- From: ROSENSTEIN1 Rosenstein, Larry
-
- To: MADA2 MacApp Dev Assoc, Curtis Faith
- MACAPP.TECH$ MacApp Technical
-
- Sub: RE>RE- Persistence - Obje
-
- Attn: MacApp Dev Assoc, Curtis Faith
- Attn: MacApp Tech
- SentBy: Larry Rosenstein
- Date 1/4/90
- Subject RE>RE- Persistence - Object
- From Larry Rosenstein
- To MacApp Dev Assoc, Curtis Faith
- MacApp Tech
-
- Reply to: RE>RE: Persistence - Object I/
- Curtis,
-
- I don't think you necessarily have to be limited to a tree structure, although
- you do have to worry about saving all the objects in the heap because they all
- refer to one another. Handling shared references is conceptually simple.
- When you write an object, you assign it an ID. If you write the same object
- again, you write the ID rather than letting the object write itself.
-
- When reading, you have to keep a table mapping the IDs to objects that have
- been created. When you read an object you create it and enter it into the
- table. When you see an object ID, you look it up in the table rather than
- creating another object.
-
- I think if you restrict yourself to reading the stream from start to finish,
- then you will always create the object before encountering its ID. You might
- also want to optimize the case where you know there aren't multiple references
- to a particular object. (Then it doesn't need to be assigned an ID.)
-
- Note that you can use the same code to write an object to a stream to write an
- object to an InsideOut database. You can implement a subclass of TStream or
- write the object to a handle and store the data in the database. So you only
- have to go through the trouble of writing ReadFrom and WriteTo once.
-
- You can use your idea of defining ranges of bytes as well. The TStream class
- supports reading and writing an arbitrary series of bytes.
-
- When SADE supports Object Pascal, it might be possible to examine the SADE
- information to find out the field layout of an object. You could write a
- utility that converted this info into a compact resource. Then ReadFrom and
- WriteTo could have a useful default that looked at this info an did the
- appropriate thing.
-
- Jeff's description of an object caching scheme is a logical extension of the
- capability of writing objects to a stream. It requires a more sophisticated
- implementation because you need to address individual objects, and you need to
- manage objects in memory and on the disk.
-
- Larry Rosenstein
-
-
-